home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 351-375 / disk_368 / popmenu / popmenu_pak.h < prev    next >
C/C++ Source or Header  |  1992-05-06  |  6KB  |  140 lines

  1. /***************************************************************************
  2.  * popmenu_pak.h -general-purpose dynamic Pop-up Menu routines to help make*
  3.  *                programming alot easier.                                 *
  4.  *                (c) 1990 VIDEOWORKS Computer Applications                *
  5.  *                All rights reserved.                                     *
  6.  *                129 Orchard Avenue, Rocky Mount, VA 24151                *
  7.  *                (703) 483-8219 / 489-3863                                *
  8.  *                                                                         *
  9.  *                Designed and Developed by Paul T. Miller                 *
  10.  *                                                                         *
  11.  * Program Name:  N/A                                                      *
  12.  * Version:       1                                                        *
  13.  * Revision:      0                                                        *
  14.  *-------------------------------------------------------------------------*
  15.  * File: (popmenu_pak.h) popmenu_pak.c header file                         *
  16.  *-------------------------------------------------------------------------*
  17.  * Modification History                                                    *
  18.  * Date     Author   Comment                                               *
  19.  * -------- ------   -------                                               *
  20.  * 03-29-90    PTM   Created. PMenu/PMenuItem structures and constants
  21.  *
  22.  ***************************************************************************/
  23.  
  24. #ifndef POPMENU_PAK_H
  25. #define POPMENU_PAK_H
  26.  
  27. #ifndef EXEC_TYPES_H
  28. #include <exec/types.h>
  29. #endif
  30.  
  31. #ifndef EXEC_MEMORY_H
  32. #include <exec/memory.h>
  33. #endif
  34.  
  35. #ifndef GRAPHICS_GFX_H
  36. #include <graphics/gfx.h>
  37. #endif
  38.  
  39. #ifndef INTUITION_INTUITION_H
  40. #include <proto/intuition.h>
  41. #endif
  42.  
  43. /* PMenu structure - based closely on Intuition Menu structure */
  44. struct PMenu
  45. {
  46.    struct PMenu  *NextPMenu;     /* next one in list */
  47.    struct Window *PMenuWindow;   /* window this menu resides in */
  48.    SHORT          LeftEdge;      /* top-left corner of activate box */
  49.    SHORT          TopEdge;
  50.    SHORT          Width;         /* width is user-set or based on items */
  51.    SHORT          Height;        /* height is user-set or based on font */
  52.    USHORT         Flags;         /* some status stuff */
  53.    SHORT          pad;           /* addresses should be long-word aligned */
  54.    UBYTE         *MenuName;      /* goes in activate box (for COMMPMENU) */
  55.    struct PMenuItem *FirstPItem; /* first item in list */
  56.    struct PMenuItem *ActiveItem; /* active item (the one displayed) */
  57.    struct Gadget *PMenuGadget;   /* pointer to activate box gadget */
  58.    SHORT JazzX, JazzY, BeatX, BeatY; /* we can have mysterious stuff too...*/
  59. };
  60.  
  61. /* FLAGS SET BY THE APPLIPROG */
  62. #define LISTPMENU    0x1000      /* menu items are list only (w/ checks) */
  63. #define COMMPMENU    0x2000      /* menu items are commands (only one) */
  64. #define SHADOWED     0x0002      /* shadow the menu Mac-style */
  65. #define TITLED       0x0008      /* user-controlled menu title */
  66.  
  67. /* SET BY POPUPMENU */
  68. #define MENU_INIT    0x0004      /* has it been installed into a window? */
  69. #define PREDEFINED   0x4000      /* PMenuItems were pre-defined */
  70.  
  71. /* The following flags are the same as in intuition.h, so we comment only.
  72. #define MENUENABLED 0x0001        * whether or not this menu is enabled
  73.  
  74.    FLAGS SET BY POPUPMENU
  75. #define MIDRAWN 0x0100            * this menu's items are currently drawn
  76. */
  77.  
  78. /* PMenuItem structure - based loosely on Intuition MenuItem structure */
  79. struct PMenuItem
  80. {
  81.    struct PMenuItem *NextPItem;     /* Next PMenuItem in list */
  82.    USHORT            Flags;         /* see below for details */
  83.    LONG              MutualExclude; /* for LISTPMENU only */
  84.    APTR              ItemFill;      /* Only IntuiText supported right now */
  85.    APTR              SelectFill;    /* Currently not supported */
  86. };
  87.  
  88. /* FLAGS SET BY THE APPLIPROG */
  89. #define CENTERED        0x0004  /* center the menu text in the fields */
  90.  
  91. /* The following flags are the same as in intuition.h, so we comment only.
  92.  
  93. #define ITEMTEXT        0x0002  * set if textual, clear if graphical item *
  94. #define ITEMENABLED     0x0010  * set if this item is enabled *
  95.  
  96.    these are the SPECIAL HIGHLIGHT FLAG state meanings
  97. #define HIGHFLAGS       0x00C0  * see definitions below for these bits *
  98. #define HIGHIMAGE       0x0000  * use the user's "select image" *
  99. #define HIGHCOMP        0x0040  * highlight by complementing the selectbox *
  100. #define HIGHBOX         0x0080  * highlight by "boxing" the selectbox *
  101. #define HIGHNONE        0x00C0  * don't highlight *
  102.  
  103.  * FLAGS SET BY BOTH APPLIPROG AND POPMENU *
  104. #define CHECKED         0x0100  * then set when selected/active *
  105.  
  106. */
  107.  
  108.  
  109. /* popmenu_pak.c function prototypes */
  110.  
  111. /* application callable routines */
  112. struct PMenu *BuildPMenu(struct PMenuItem *, USHORT, SHORT, UBYTE *, USHORT);
  113. void SetPMenuColor(struct PMenu *, USHORT, USHORT);
  114. int InitPMenu(struct Window *, struct PMenu *, SHORT, SHORT);
  115. void RemovePMenu(struct PMenu *);
  116. void FreePMenu(struct PMenu *);
  117. void SetActiveItem(struct PMenu *, SHORT);
  118. struct PMenuItem *GetPItem(struct PMenu *, SHORT);
  119. SHORT GetPItemNum(struct PMenu *, struct PMenuItem *);
  120. int CountPMenuItems(struct PMenu *);
  121. void SetPMenuText(struct PMenu *, UBYTE *);
  122. void RefreshPMenu(struct PMenu *);
  123. USHORT HandlePMenu(struct PMenu *);
  124.  
  125. /* support routines */
  126. int find_maxpitemwidth(struct PMenu *);
  127. void calc_border(struct PMenu *);
  128. void calc_menusize(struct PMenu *);
  129. struct BitMap *savebackground(struct PMenu *);
  130. void restorebackground(struct PMenu *, struct BitMap *);
  131. void drawpmenu(struct PMenu *);
  132. struct PMenuItem *getmenuitem(struct PMenu *, SHORT, SHORT);
  133. void handle_items(struct PMenu *, SHORT, SHORT, SHORT *);
  134. void complement_item(struct PMenu *, SHORT);
  135. struct BitMap *allocbitmap(USHORT, USHORT, UBYTE);
  136. void freebitmap(struct BitMap *);
  137.  
  138. #endif   /* POPMENU_PAK_H */
  139.  
  140.